package levels;

import gameconstruction.GameObject;
import gameconstruction.LevelCreator;

import java.util.ArrayList;

import model.ModelContext;
import moving.Hero;
import statics.Target;
import statics.Wall;
import controller.GameController;
import datacontainers.Location2D;
import drawing.DrawAbles;

public class Level1 implements LevelCreator{
	private final ArrayList<GameObject> obj = new ArrayList<GameObject>();
	
	public Level1(){
		//assume 640x480 level size
		
		//add the walls
		for(int i = 0;i<640;i+=32)	obj.add(new Wall(new Location2D(i,480-32)));
		//add some targets
		for(int i = 40;i<640;i+=640/4)obj.add(new Target(new Location2D(i,480-64)));
		//add the character
		obj.add(new Hero(new Location2D(32,640-96)));
	}
	
	@Override
	public void spawnModels(ModelContext mo) {
		for(GameObject o:obj){
			mo.spawn(o);
		}
	}

	@Override
	public void spawnControllers(GameController gc) {
		for(GameObject o:obj){
			gc.addController(o);
		}
	}

	@Override
	public void spawnViews(DrawAbles vc) {
		for(GameObject o:obj){
			vc.getDrawables().add(o);
		}
	}

}
